package com.hongxun.design.utils.httputil;

import android.os.Handler;

import com.alibaba.fastjson.JSON;
import com.baidu.mapapi.model.LatLng;
import com.hongxun.design.MyApp;
import com.hongxun.design.bean.CodelibraryConditionBean;
import com.hongxun.design.bean.ConsumerInfo;
import com.hongxun.design.bean.CreateDistanceBean;
import com.hongxun.design.bean.CreateProjectBean;
import com.hongxun.design.bean.Exploration;
import com.hongxun.design.bean.LogProjectBean;
import com.hongxun.design.bean.PhotoEnvironmentalItemBean;
import com.hongxun.design.bean.SetPointInfItemBean;
import com.hongxun.design.constant.Constant;
import com.hongxun.design.mytools.MString;
import com.hongxun.design.mytools.MyLog;
import com.hongxun.design.mytools.ToastShow;
import com.lidroid.xutils.http.RequestParams;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by zerdoor_pc on 2016/5/19.
 */
public class HttpUtil {
    static HttpUtil instence;
    public HttpRootUtil http;

    HttpUtil() {
        http = HttpRootUtil.getInsence();
    }

    public static HttpUtil getIntence() {
        if (instence == null) {
            instence = new HttpUtil();
        }
        return instence;
    }

    /**
     * 获取APP基本配置*
     */
    public void getBaseConfig(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.BaseConfig;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取平台配置信息*
     */
    public void getSystemType(Handler handler, int i) {
        String url = null;
        try {
            url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.SysType + "?typegroupid=" + URLEncoder.encode(HttpStringCodeTableUtil.AllCode, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    public void getSystemType(Handler handler, int i, String s) {
        String url = null;
        url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.SysType + "?typegroupid=" + HttpStringCodeTableUtil.voltageType;

        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 首页图片轮播*
     */
    public void getCarousel(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.Carousel;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取典设版本信息*
     */
    public void getCodeSetVersion(Handler handler, int i, String codeset_type) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.CodesetVersion + "?codeset_type=" + codeset_type;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取典设列表信息*
     */
    public void getCodeSetList(Handler handler, int i, String codeset_version_id, String pt_id,
                               List<CodelibraryConditionBean> beans, int s, int n, String type, String... filter) {
//        典设名称：name 典设版本：codeset_version_id 典设类型：pt_id 典设关键字：keyword 开始序号：s 获取条数：n
        String code = "";
        switch (type) {
            case MString.click_in:
                code = "?codeset_version_id=" + codeset_version_id + "&pt_id=" + pt_id + "&s=" + s + "&n=" + n;
                if (filter.length > 0 && filter[0].length() > 0) {
                    code += "&filter=" + filter[0];
                }
                break;
            case MString.click_out:
                code = "?s=" + s + "&n=" + n;
                break;
            case MString.ChoiceModelData:
                code = "?codeset_version_id=" + codeset_version_id + "&s=" + s + "&n=" + n;
                break;
        }
        if (beans != null) {
            for (CodelibraryConditionBean bean : beans) {
                if (bean.getNamecode().length() != 0) {
                    code += "&" + bean.getNamecode() + "=" + bean.getValuecode();
                }
            }
        }
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.CodesetList + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取典设材料明细列表信息*
     */
    public void getCodeSetMaterialList(Handler handler, int i, String codeset_id) {
//        典设名称：name 典设版本：codeset_version_id 典设类型：pt_id 典设关键字：keyword 开始序号：s 获取条数：n
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.CodesetMaterial + "?codeset_id=" + codeset_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * (new)获取模块材料明细列表信息
     */
    public void getModelMaterialList1(Handler handler, int i, String codeset_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/modleMaterial?modle_id=" + codeset_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    /**
     * 获取典设材料列表信息*
     */
    public void getQueryExpCodeset(Handler handler, int i, String exploration_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.QueryExpCodeset + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    /**
     * 获取材料列表*
     */
    public void getMaterialList(Handler handler, int i, String name, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.MaterialControl + HttpStringUtil.MaterialList + "?name=" + name + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * @param version 典设版本
     *                获取材料列表*
     */
    public void getMaterialList1(Handler handler, int i, String name, String type, String version, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.MaterialControl + HttpStringUtil.MaterialList + "?name=" + name + "&type=" + type + "&versionid=" + version + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * @param version 典设版本
     *                获取材料列表*
     */
    public void getMaterialListAll(Handler handler, int i, String name, String type, String version) {
        String url = HttpStringUtil.Head + HttpStringUtil.MaterialControl + HttpStringUtil.MaterialListAll + "?name=" + name + "&type=" + type + "&versionid=" + version;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * @param version 典设版本
     *                获取材料列表*
     */
    public void getMaterialType(Handler handler, int i, String version) {
        String url = HttpStringUtil.Head + HttpStringUtil.MaterialControl + HttpStringUtil.Materialtype + "?versionid=" + version;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 个人项目阶段列表*
     */
    public void getProjectList(Handler handler, int i, String project_name, int s, int n, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.ProjectList + "?s=" + s + "&n=" + n + "&project_name=" + project_name;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 条件查询个人所有项目*
     */
    public void SearchAllProject(Handler handler, int i, String project_name, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.SearchAllProject + "?project_name=" + project_name;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 删除项目阶段*
     */
    public void DelProjectStage(Handler handler, int i, String stage_id) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("stage_id", stage_id);
        MyLog.L(MString.SUCCESSED + "&stage_id=" + stage_id);
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.DelProjectStage;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 查询项目阶段信息*
     */
    public void getProjectInfo(Handler handler, int i, String stage_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.ProjectInfo + "?stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 条件查询个人项目阶段*
     */
    public void getSearchProject(Handler handler, int i, String project_name, String start_year, String end_year, String current_stage, String project_type, String current_schedule, String owner_unit, String design_unit, int s, int n) {
//        project_name start_year end_year current_stage project_type current_schedule owner_unit design_unit s n
        String code = "?project_name=" + project_name + "&start_year=" + start_year + "&end_year=" + end_year +
                "&current_stage=" + current_stage + "&project_type=" + project_type + "&current_schedule=" + current_schedule + "&owner_unit=" + owner_unit + "&design_unit=" + design_unit + "&s=" + s + "&n=" + n;
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.SearchProject + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取模块列表*
     */
    public void getModuleList(Handler handler, int i, String name, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.ModuleControl + HttpStringUtil.ModuleList + "?name=" + name + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * @param versionid 典设版本
     *                  获取模块列表*
     */
    public void getModuleList1(Handler handler, int i, String name, String versionid, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.ModuleControl + HttpStringUtil.ModuleList + "?name=" + name + "&versionid=" + versionid + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * (new)项目典设模块
     */
    public void getModuleList2(Handler handler, int i, String name, String versionid, int s, int n) {
//        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.ModuleList + "?name=" + name + "&codeset_version_id=" + versionid + "&s=" + s + "&n=" + n;
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/modleList?name=" + name + "&codeset_version_id=" + versionid + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 修改项目阶段基本信息*
     */
    public void UpProject(Handler handler, int i, List<CreateProjectBean> data, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.UpProject;
        MyApp.createProject.setBean(MyApp.currProject);
        RequestParams params = PostParams.CreateProject(data);
        params.addBodyParameter("stage_id", stage_id);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 创建项目信息上传*
     */
    public void sendProject(Handler handler, int i, List<CreateProjectBean> data) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.CreateProject;
        http.Post(HttpStringUtil.getUrl(url), PostParams.CreateProject(data), handler, i);
    }


    /**
     * 文件信息上传*
     */
    public void sendFile(Handler handler, int i, File file, String type) {
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.Upload;
        http.Post(HttpStringUtil.getUrl(url), PostParams.File(file, type), handler, i);
    }

    /**
     * 获取单位信息*
     */
    public void getListOfUnits(Handler handler, int i, String orgType) {

        String url = HttpStringUtil.Head + HttpStringUtil.OrgUserControl + HttpStringUtil.OrgList + "?orgType=" + orgType;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取人员列表*
     */
    public void getPersonnelList(Handler handler, int i, String userType, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.OrgUserControl + HttpStringUtil.UserByTypeList + "?userType=" + userType + "&stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 添加bj
     */
    public void addBj(Handler handler, int i, String bx_id, String bjList) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.AddBj;
        http.Post(HttpStringUtil.getUrl(url), PostParams.getBjList(bx_id, bjList), handler, i);
    }

    /**
     * 踏勘点信息设置*
     */
    public void setExploration(Handler handler, int i, String stage_id, List<SetPointInfItemBean> data, List<Exploration> point) {
        for (SetPointInfItemBean s : data) {
            if (s.getItemStyle() == Constant.LatStyle) {
                if ((s.getLat() == 0 || s.getLat() == -1) || s.getLon() == 0 || s.getLon() == -1) {
                    ToastShow.showShort(MyApp.activity, "无效的地理位置！");
                }
            } else if (s.isNotNull()) {
                switch (s.getItemStyle()) {
                    case Constant.EdStyle:
                        if (!(s.getValue() != null && s.getValue().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    case Constant.ChoiceStyle:
                        if (!(s.getValueCode() != null && s.getValueCode().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    default:
                        if (!((s.getValue() != null && s.getValue().length() > 0) || (s.getValueCode() != null && s.getValueCode().length() > 0))) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                }
            }
        }
        if (point == null) point = new ArrayList<>();
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.AddExploration;
        http.Post(HttpStringUtil.getUrl(url), PostParams.setExploration(stage_id, data, point), handler, i);
    }


    /**
     * 踏勘点信息设置(离线)*
     */
    public boolean setExplorationOutLine(String stage_id, List<SetPointInfItemBean> data, List<Exploration> point) {
        for (SetPointInfItemBean s : data) {
            if (s.getItemStyle() == Constant.LatStyle) {
                if ((s.getLat() == 0 || s.getLat() == -1) || s.getLon() == 0 || s.getLon() == -1) {
                    ToastShow.showShort(MyApp.activity, "无效的地理位置！");
                }
            } else if (s.isNotNull()) {
                switch (s.getItemStyle()) {
                    case Constant.EdStyle:
                        if (!(s.getValue() != null && s.getValue().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return false;
                        }
                        break;
                    case Constant.ChoiceStyle:
                        if (!(s.getValueCode() != null && s.getValueCode().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return false;
                        }
                        break;
                    default:
                        if (!((s.getValue() != null && s.getValue().length() > 0) || (s.getValueCode() != null && s.getValueCode().length() > 0))) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return false;
                        }
                        break;
                }
            }
        }
        PostParams.setExploration(stage_id, data, point);
        return true;
    }

    /**
     * 踏勘点信息继续设置*
     */
    public void setConAddExploration(Handler handler, int i, List<SetPointInfItemBean> data) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ConAddExploration;
        http.Post(HttpStringUtil.getUrl(url), PostParams.setConExploration(data), handler, i);
    }

    /**
     * 删除踏勘点*
     */
    public void delectExploration(Handler handler, int i, String exploration_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.DelExplor;
        http.Post(HttpStringUtil.getUrl(url), PostParams.delectExploration(exploration_id), handler, i);
    }

    /**
     * 获取踏勘点信息*
     */
    public void getExploration(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ExplorInfo + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 获取新点编号*
     */
    public void getNewNum(Handler handler, int i, String stage_id, String pt_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.StageControl + HttpStringUtil.GetNewNum + "?stage_id=" + stage_id + "&pt_id=" + pt_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取踏勘点列表*
     */
    public void getExplorationList(Handler handler, int i, String exploration_type, String stage_id, String explor_id, String... save) {
        if (stage_id == null || stage_id.length() == 0) return;
        String code;
        if (exploration_type.length() == 0) {
            code = "?stage_id=" + stage_id + "&explor_id=" + explor_id;
        } else if (explor_id.length() == 0) {
            code = "?exploration_type=" + exploration_type + "&stage_id=" + stage_id;
        } else {
            code = "?exploration_type=" + exploration_type + "&stage_id=" + stage_id + "&explor_id=" + explor_id;
        }
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ExplorationList + code;
        MyLog.L(MString.SUCCESSED + "  ExplorationList url==" + url);
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 修改踏勘点信息*
     */
    public void setExplorationList(Handler handler, int i, List<SetPointInfItemBean> data, String pt_id, List<Exploration> point) {
        for (SetPointInfItemBean s : data) {
            if (s.getItemStyle() == Constant.LatStyle) {
                if ((s.getLat() == 0 || s.getLat() == -1) || s.getLon() == 0 || s.getLon() == -1) {
                    ToastShow.showShort(MyApp.activity, "无效的地理位置！");
                }
            } else if (s.isNotNull()) {
                switch (s.getItemStyle()) {
                    case Constant.EdStyle:
                        if (!(s.getValue() != null && s.getValue().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    case Constant.ChoiceStyle:
                        if (!(s.getValueCode() != null && s.getValueCode().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    default:
                        if (!((s.getValue() != null && s.getValue().length() > 0) || (s.getValueCode() != null
                                && s.getValueCode().length() > 0))) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                }
            }
        }
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.UpExploration;
        http.Post(HttpStringUtil.getUrl(url), PostParams.updateExploration(data, pt_id, point), handler, i);
    }

    public void setExplorationList(List<SetPointInfItemBean> data, String pt_id, List<Exploration> point) {
        for (SetPointInfItemBean s : data) {
            if (s.getItemStyle() == Constant.LatStyle) {
                if ((s.getLat() == 0 || s.getLat() == -1) || s.getLon() == 0 || s.getLon() == -1) {
                    ToastShow.showShort(MyApp.activity, "无效的地理位置！");
                }
            } else if (s.isNotNull()) {
                switch (s.getItemStyle()) {
                    case Constant.EdStyle:
                        if (!(s.getValue() != null && s.getValue().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    case Constant.ChoiceStyle:
                        if (!(s.getValueCode() != null && s.getValueCode().length() > 0)) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                    default:
                        if (!((s.getValue() != null && s.getValue().length() > 0) || (s.getValueCode() != null && s.getValueCode().length() > 0))) {
                            ToastShow.showShort(MyApp.activity, s.getName() + "值不能为空！");
                            return;
                        }
                        break;
                }
            }
        }

        PostParams.updateExploration(data, pt_id, point);
    }

    /**
     * 修改踏勘点*
     */
    public void updateExplorationList(Handler handler, int i, String exploration_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ExplorationList;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取上联踏勘点*
     */
    public void getLastExp(Handler handler, int i, String stage_id, String exploration_type, String classify) {
        //projectControl/getLastExp?stage_id=5763&classify=1
        String msg = "?stage_id=" + stage_id + "&classify=" + classify + "&pt_type=" + exploration_type;
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectControl + HttpStringUtil.GetLastExp + msg;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取导线类型列表*
     */
    public void getWireList(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.WireList;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    /**
     * 查询踏勘照片*
     */
    public void getExpPhotoList(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpPhotoControl + HttpStringUtil.ExpPhotoList + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 保存踏勘照片*
     */
    public void SaveExpPhoto(Handler handler, int i, File file, String type, String exploration_id, int photo_type) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpPhotoControl + HttpStringUtil.SaveExpPhoto;
        MyLog.L(MString.SUCCESSED + "file:" + file.length());
        http.Post(HttpStringUtil.getUrl(url), PostParams.SaveExpPhoto(file, type, exploration_id, photo_type), handler, i);
    }

    /**
     * 删除踏勘照片*
     */
    public void DelExpPhoto(Handler handler, int i, String photo_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpPhotoControl + HttpStringUtil.DelExpPhoto;
        http.Post(HttpStringUtil.getUrl(url), PostParams.DelExpPhoto(photo_id), handler, i);
    }

    /**
     * 获取踏勘环境信息*
     */
    public void getEnvInfo(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.EnvironmentControl + HttpStringUtil.EnvInfo + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 保存踏勘环境信息*
     */
    public boolean SaveEnv(Handler handler, int i, Object data) {
        List<PhotoEnvironmentalItemBean> Beans = (List<PhotoEnvironmentalItemBean>) data;
        for (PhotoEnvironmentalItemBean p : Beans) {
            if (p.ismust()) {
                if (p.getType() == Constant.ChoiceItem) {
                    if (p.getValuecode() == null || p.getValuecode().length() == 0) {
                        ToastShow.showShort(MyApp.activity, p.getTitle() + "值不能为空！");
                        return false;
                    }
                } else {
                    if (p.getValue() == null || p.getValue().length() == 0) {
                        ToastShow.showShort(MyApp.activity, p.getTitle() + "值不能为空！");
                        return false;
                    }
                }
            }
        }
        String url = HttpStringUtil.Head + HttpStringUtil.EnvironmentControl + HttpStringUtil.SaveEnv;
        http.Post(HttpStringUtil.getUrl(url), PostParams.SaveEnv(data), handler, i);
        return false;
    }

    /**
     * 保存踏勘环境信息(离线)*
     */
    public Map<String, Object> SaveEnv(Object data) {
        List<PhotoEnvironmentalItemBean> Beans = (List<PhotoEnvironmentalItemBean>) data;
        for (PhotoEnvironmentalItemBean p : Beans) {
            if (p.ismust()) {
                if (p.getType() == Constant.ChoiceItem) {
                    if (p.getValuecode() == null || p.getValuecode().length() == 0) {
                        ToastShow.showShort(MyApp.activity, p.getTitle() + "值不能为空！");
                        return null;
                    }
                } else {
                    if (p.getValue() == null || p.getValue().length() == 0) {
                        ToastShow.showShort(MyApp.activity, p.getTitle() + "值不能为空！");
                        return null;
                    }
                }
            }
        }

        PostParams.SaveEnv(data);

        return PostParams.map;
    }

    /**
     * 获取定位点上级定位点*
     */
    public void getBeforeExp(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.BeforeExp + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 通道特征点(有下级)列表*
     */
    public void getChannelAList(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.ChannelAList + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 通道特征点（无上级）列表*
     */
    public void getChannelList(Handler handler, int i, String exploration_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.ChannelList + "?exploration_id=" + exploration_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);

    }

    /**
     * 关联通道特征信息*
     */
    public void CorrChannelFeature(Handler handler, int i, String exploration_id, String after_exp) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.CorrChannelFeature;
        http.Post(HttpStringUtil.getUrl(url), PostParams.CorrChannelFeature(exploration_id, after_exp), handler, i);
    }

    /**
     * 新增通道特征信息*
     */
    public void AddChannelFeature(Handler handler, int i, String pt_id, String after_exp, String distance) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.AddChannelFeature;
        http.Post(HttpStringUtil.getUrl(url), PostParams.AddChannelFeature(pt_id, after_exp, distance), handler, i);
    }

    /**
     * 查询特征点信息*
     */
    public void QueryChannelFeature(Handler handler, int i, String channel_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.QueryChannelFeature + "?channel_id=" + channel_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 修改通道特征信息*
     */
    public void UpChannelFeature(Handler handler, int i, String channel_id, Object data) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.UpChannelFeature;
        http.Post(HttpStringUtil.getUrl(url), PostParams.UpChannelFeature(channel_id, data), handler, i);
    }

    /**
     * 修改通道特征点距离信息*
     */
    public void upExpDistance(Handler handler, int i, String exploration, String distance) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("exploration_id", exploration);
        params.addBodyParameter("distance", distance);
        MyLog.L(MString.SUCCESSED + "  exploration_id=" + exploration + "  &distance=" + distance);
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.upExpDistance;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 删除通道特征信息*
     */
    public void DelChannelFeature(Handler handler, int i, String channel_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ChannelControl + HttpStringUtil.DelChannelFeature;
        http.Post(HttpStringUtil.getUrl(url), PostParams.DelChannelFeature(channel_id), handler, i);
    }


    /**
     * 删除踏勘典设材料*
     */
    public void DelExpMaterial(Handler handler, int i, String id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.DelExpMaterial;
        http.Post(HttpStringUtil.getUrl(url), PostParams.DelExpMaterial(id), handler, i);
    }


    /**
     * 修改踏勘典设材料数量*
     */
    public void UpExpMaterial(Handler handler, int i, String id, String obj_id, String num, String use_type) {
//        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.UpExpMaterial;
//        http.Post(HttpStringUtil.getUrl(url), PostParams.UpExpMaterial(id, num, use_type), handler, i);


        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.UpCodesetMaterial;
        http.Post(HttpStringUtil.getUrl(url), PostParams.UpExpMaterial(id, obj_id, num, use_type), handler, i);
        //http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 踏勘典设导入材料*
     */
    public void ImpExpMaterial(Handler handler, int i, String id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.ImpExpMaterial;
        http.Post(HttpStringUtil.getUrl(url), PostParams.ImpExpMaterial(id), handler, i);
    }

    /**
     * 踏勘典设导入模块*
     */
    public void ImpExpModule(Handler handler, int i, String id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.ImpExpModule;
        http.Post(HttpStringUtil.getUrl(url), PostParams.ImpExpModule(id), handler, i);
    }


    /**
     * 保存踏勘典设方案*
     */
    public void SaveExpCodeset(Handler handler, int i, String codeset_id, String exploration_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + HttpStringUtil.SaveExpCodeset;
        http.Post(HttpStringUtil.getUrl(url), PostParams.SaveExpCodeset(codeset_id, exploration_id), handler, i);
    }

    /**
     * 项目阶段点位统计*
     */
    public void getPointSum(Handler handler, int i, String stage_id, String explor_id, String... save) {
        String msg = "?stage_id=" + stage_id + "&explor_id=" + explor_id;
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.PointSum + msg;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 个人项目进度统计*
     */
    public void getScheduleCount(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.ScheduleCount;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 项目阶段台区统计*
     */
    public void getExplorSum(Handler handler, int i, String explor_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.ExplorSum + "?explor_id=" + explor_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }


    /**
     * 获取台区*
     */
    public void getTransformerList(Handler handler, int i, String stage_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.TransformerList + "?stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 获取台区数据*
     */
    public void getSectionCorss(Handler handler, int i, String explor_id, String exploration_type, String... save) {

        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.SectionCorss + "?explor_id=" + explor_id + "&stage_id=" + MyApp.currProject.getStage_id() + "&exploration_type=" + exploration_type;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 台区材料统计*
     */
    public void getMaterialSum(Handler handler, int i, String explor_id, String exploration_type, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.MaterialSum + "?explor_id=" + explor_id + "&stage_id=" + MyApp.currProject.getStage_id() + "&exploration_type=" + exploration_type;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 获取杆塔明细信息*
     */
    public void getPoleSum(Handler handler, int i, String stage_id, String voltageGrade, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.PoleSum + "?stage_id=" + stage_id + "&voltageGrade=" + voltageGrade;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }

    /**
     * 阶段用电户*
     */
    public void getUserPoint(Handler handler, int i, String stage_id, String... save) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.UserPoint + "?stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i, save);
    }


    /**
     * 百科分类*
     */
    public void getCategory(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.EncyclopediaControl + HttpStringUtil.Category;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 百科列表*
     */
    public void getEncyclopediaList(Handler handler, int i, String name, String category_id, int s, int n) {
        String code = "?name=" + name + "&category_id=" + category_id + "&s=" + s + "&n=" + n;
        String url = HttpStringUtil.Head + HttpStringUtil.EncyclopediaControl + HttpStringUtil.EncyclopediaList + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 百科详情*
     */
    public void getEncyclopediaContent(Handler handler, int i, String encyclopedia_id) {
        String code = "?encyclopedia_id=" + encyclopedia_id;
        String url = HttpStringUtil.Head + HttpStringUtil.EncyclopediaControl + HttpStringUtil.GetEncyclopediaContent + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 经验详情*
     */
    public void GetExperienceContent(Handler handler, int i, String experience_id) {
        String code = "?experience_id=" + experience_id;
        String url = HttpStringUtil.Head + HttpStringUtil.ExperienceControl + HttpStringUtil.GetExperienceContent + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 百科收藏列表*
     */
    public void getCollectList(Handler handler, int i, String name, int s, int n) {
        String code = "?name=" + name + "&s=" + s + "&n=" + n;
        String url = HttpStringUtil.Head + HttpStringUtil.FavoriteControl + HttpStringUtil.collectList + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取系统文章内容*
     */
    public void getSysArticleContent(Handler handler, int i, String id) {
        String code = "?id=" + id;
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.GetSysArticleContent + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 添加收藏*
     */
    public void addCollect(Handler handler, int i, String encyclopedia_id) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("encyclopedia_id", encyclopedia_id);
        MyLog.L(MString.SUCCESSED + " encyclopedia_id=" + encyclopedia_id);
        String url = HttpStringUtil.Head + HttpStringUtil.FavoriteControl + HttpStringUtil.AddCollect;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 删除收藏*
     */
    public void delCollect(Handler handler, int i, String favorite_id) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("favorite_id", favorite_id);
        MyLog.L(MString.SUCCESSED + " favorite_id=" + favorite_id);
        String url = HttpStringUtil.Head + HttpStringUtil.FavoriteControl + HttpStringUtil.DelCollect;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 注册*
     */
    public void regedit(Handler handler, int i, List<CreateDistanceBean> beans) {
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.Regedit;
        http.Post(HttpStringUtil.getUrl(url), PostParams.regedit(beans), handler, i);
    }

    /**
     * 发送短信验证码*
     */
    public void SendIdentCode(Handler handler, int i, String phone, String key, int templet) {
        String s = "?key=" + key + "&phone=" + phone + "&templet=" + templet;
        MyLog.L(MString.SUCCESSED + " s=" + s);
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.SendIdentCode + s;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 登陆*
     */
    public void login(Handler handler, int i, String username, String pwd) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("username", username);
        params.addBodyParameter("pwd", pwd);
        MyLog.L(MString.SUCCESSED + " username=" + username + "&pwd=" + pwd);
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.Login;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 短信找回密码*
     */
    public void SmsRetrieve(Handler handler, int i, List<CreateDistanceBean> beans, String key) {
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("key", key);
        s += "&key=" + key;

        for (CreateDistanceBean b : beans) {
            params.addBodyParameter(b.getTitleCode(), b.getValue());
            s += "&" + b.getTitleCode() + "=" + b.getValue();
        }
        MyLog.L(MString.SUCCESSED + "s=" + s);
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.SmsRetrieve;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 设置密保问题*
     */
    public void SetSecurityProblem(Handler handler, int i, List<CreateDistanceBean> beans) {
        RequestParams params = new RequestParams();
        String s = "";
        for (CreateDistanceBean b : beans) {
            params.addBodyParameter(b.getTitleCode(), b.getValue());
            s += "&" + b.getTitleCode() + "=" + b.getValue();
        }
        MyLog.L(MString.SUCCESSED + "s=" + s);
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.SetSecurityProblem;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 获取密保问题*
     */
    public void getSecurityProblem(Handler handler, int i, String username) {
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.GetSecurityProblem + "?username=" + username;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 密保找回密码*
     */
    public void SecurityRetrieve(Handler handler, int i, String username, List<CreateDistanceBean> beans) {
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("username", username);
        s += "&username=" + username;
        for (CreateDistanceBean b : beans) {
            if (b.getTitleCode().equals(MString.security_answer1) || b.getTitleCode().equals(MString.security_answer2)) {
                params.addBodyParameter(b.getTitleCode(), b.getValue());
                s += "&" + b.getTitleCode() + "=" + b.getValue();
            }

        }
        MyLog.L(MString.SUCCESSED + "s=" + s);
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.SecurityRetrieve;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 修改密码*
     */
    public void UpPsd(Handler handler, int i, List<CreateDistanceBean> beans) {
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("key", MString.ModifyPasswordKey);
        s += "&key=" + MString.ModifyPasswordKey;

        for (CreateDistanceBean b : beans) {
            params.addBodyParameter(b.getTitleCode(), b.getValue());
            s += "&" + b.getTitleCode() + "=" + b.getValue();
        }
        MyLog.L(MString.SUCCESSED + "s=" + s);
        //phone key password validcode
        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.UpPsd;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 修改密码*
     */
    public void reUpPsd(Handler handler, int i, String username, String token, String password) {
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("username", username);
        s += "&username=" + username;
        params.addBodyParameter("token", token);
        s += "&token=" + token;
        params.addBodyParameter("password", password);
        s += "&password=" + password;

        MyLog.L(MString.SUCCESSED + "s=" + s);

        String url = HttpStringUtil.Head + HttpStringUtil.OauthControl + HttpStringUtil.ReUpPsd;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 获取指定用户id*
     */
    public void GetConsumerId(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.ConsumerControl + HttpStringUtil.GetConsumerId;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取用户基本信息*
     */
    public void ConsumerInfo(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.ConsumerControl + HttpStringUtil.ConsumerInfo;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    /**
     * 修改用户基本信息*
     */
    public ConsumerInfo UpConsumerInfo(Handler handler, int i, List<CreateDistanceBean> beans) {
        RequestParams params = new RequestParams();
        String s = "";
        ConsumerInfo info = new ConsumerInfo();
        for (CreateDistanceBean b : beans) {
            if (b.getValue() != null && b.getValue().length() > 0) {
                switch (b.getTitleCode()) {
                    case MString.avatar:
                        info.setAvatar(b.getValue());
                        break;
                    case MString.realname:
                        info.setRealname(b.getValue());
                        break;
                    case MString.email:
                        info.setEmail(b.getValue());
                        break;
                    case MString.qq:
                        info.setQq(b.getValue());
                        break;
                    case MString.wx:
                        info.setWx(b.getValue());
                        break;
                    case MString.birthday:
                        info.setBirthday(b.getValue());
                        break;
                    case MString.sex:
                        info.setSex(b.getValue());
                        break;
                }
            }
            params.addBodyParameter(b.getTitleCode(), b.getValue());
            s += "&" + b.getTitleCode() + "=" + b.getValue();
        }
        MyLog.L(MString.SUCCESSED + "s=" + s);
        String url = HttpStringUtil.Head + HttpStringUtil.ConsumerControl + HttpStringUtil.UpConsumerInfo;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
        return info;
    }

    /**
     * 项目自检*
     */
    public void checkProject(Handler handler, int i, String stage_id, String type) {
        String url = HttpStringUtil.Head + HttpStringUtil.CheckStatisticsControl + HttpStringUtil.CheckProject + "?type=" + type + "&stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 项目设计统计阶段*
     */
    public void ProjectSum(Handler handler, int i, String startYear, String endYear, String design_unit, String owner_unit) {

        // startYear endYear  project_attribute project_type funds_sources design_unit owner_unit
        String code = "?startYear=" + startYear + "&endYear=" + endYear + "&design_unit=" + design_unit + "&owner_unit=" + owner_unit;
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.ProjectSum + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 项目按字段统计*
     */
    public void FieldSum(Handler handler, int i, String stage, String startYear, String endYear, String design_unit, String owner_unit, int statisticsType) {
        String code = "";
        code += "?startYear=" + startYear + "&endYear=" + endYear + "&design_unit=" + design_unit + "&owner_unit=" + owner_unit + "&statisticsType=" + statisticsType;
        if (stage.length() != 0) {
            code += "&stage=" + stage;
        }
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectStatisticsControl + HttpStringUtil.FieldSum + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 项目日志搜索*
     */
    public void LogList(Handler handler, int i, String startDate, String endDate, String users, int s, int n) {
        String code = "?startDate=" + startDate + "&endDate=" + endDate + "&users=" + users + "&s=" + s + "&n=" + n;
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectLogControl + HttpStringUtil.LogList + code;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取当前项目统计*
     */
    public void TodayProSum(Handler handler, int i) {

        String url = HttpStringUtil.Head + HttpStringUtil.ProjectLogControl + HttpStringUtil.TodayProSum;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    /**
     * 日志填报*
     */
    public void AssessedLog(Handler handler, int i, List<LogProjectBean> logBeans, String voice_remark, String characters_remark) {
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("voice_remark", voice_remark);
        s += "&voice_remark=" + voice_remark;
        params.addBodyParameter("characters_remark", characters_remark);
        s += "&characters_remark=" + characters_remark;

        params.addBodyParameter("project", JSON.toJSONString(logBeans));
        MyLog.L(MString.SUCCESSED + s + "&project=" + JSON.toJSONString(logBeans));
        String url = HttpStringUtil.Head + HttpStringUtil.ProjectLogControl + HttpStringUtil.AssessedLog;
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 获取基站差分值*
     */
    public void GetDifferenceData(Handler handler, int i, double longitude, double latitude) {
        String url = HttpStringUtil.HttpHead + HttpStringUtil.BasestationControl + HttpStringUtil.GetDifferenceData + "?longitude=" + longitude + "&latitude=" + latitude + "&device_type=2";
        MyLog.L(MString.SUCCESSED + " url=" + url);
        http.isLoad = false;
        http.Get(url, handler, i);
    }


    /**
     * 获取当前项目统计*
     */
    public void stageNumByYear(Handler handler, int i) {

        String url = HttpStringUtil.Head + HttpStringUtil.FootprintControl + HttpStringUtil.StageNumByYear;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 工作统计*
     */
    public void WorkStatistics(Handler handler, int i) {

        String url = HttpStringUtil.Head + HttpStringUtil.FootprintControl + HttpStringUtil.WorkStatistics;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 统计阶段和文章*
     */
    public void StageArticleFoot(Handler handler, int i, String year) {

        String url = HttpStringUtil.Head + HttpStringUtil.FootprintControl + HttpStringUtil.StageArticleFoot + "?year=" + year;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 我的经验*
     */
    public void GetExperienceList(Handler handler, int i, String name, int s, int n) {

        String url = HttpStringUtil.Head + HttpStringUtil.ExperienceControl + HttpStringUtil.ExperienceList + "?name=" + name + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 删除经验*
     */
    public void DelExp(Handler handler, int i, String experience_id) {

        String url = HttpStringUtil.Head + HttpStringUtil.ExperienceControl + HttpStringUtil.DelExp;
        RequestParams params = new RequestParams();
        String s = "";
        params.addBodyParameter("experience_id", experience_id);
        s += "&experience_id=" + experience_id;
        MyLog.L(MString.SUCCESSED + "S=" + s);

        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 获取系统消息列表*
     */
    public void SysMessList(Handler handler, int i, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + HttpStringUtil.SysMessList + "?s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 获取转角*
     */
    public void getexpCorner(Handler handler, int i, LatLng latLng, String before_id, String type) {

        if (before_id == null || before_id.length() == 0) return;
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ExpCorner + "?exploration_id=" + MyApp.currExploration.getExploration_id() + "&lng=" + latLng.longitude + "&lat=" + latLng.latitude + "&before_id=" + before_id + "&type=" + type;
        http.Get(HttpStringUtil.getUrl(url), handler, i);

    }

    /**
     * 排直*
     */
    public void getexp_obj_up(Handler handler, int i, LatLng latLng, String before_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.Exp_obj_up + "?lng=" + latLng.longitude + "&lat=" + latLng.latitude + "&before_id=" + before_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 平台产品购买清单*
     */
    public void buyMenuList(Handler handler, int i, String appliesType) {
        String url = HttpStringUtil.Head + HttpStringUtil.PayControl + HttpStringUtil.BuyMenuList + "?appliesType=" + appliesType;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 支付接口*
     */
    public void payment(Handler handler, int i, String payid, String buy_menu_id, String people_num, String type) {
        String url = HttpStringUtil.Head + HttpStringUtil.PayControl + HttpStringUtil.Payment;
        //http.Get(HttpStringUtil.getUrl(url), handler, i);
        RequestParams params = new RequestParams();
        params.addBodyParameter("payid", payid);
        params.addBodyParameter("buy_menu_id", buy_menu_id);
        params.addBodyParameter("people_num", people_num);
        params.addBodyParameter("type", type);
        MyLog.L(MString.SUCCESSED + " &payid=" + payid + "&buy_menu_id=" + buy_menu_id + "&people_num=" + people_num + "&type=" + type);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }


    /**
     * 材料与模块型号查询*
     */
    public void getlikeNameMaterial(Handler handler, int i, String matId, int s, int n) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.LikeNameMaterial + "?matId=" + matId + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 下载项目*
     */
    public void getload(Handler handler, int i, String stageid) {
        //String url="http://192.168.1.132:7011/packageControl/projectPackage?stageId=4143&openIdent=93d979ad136d140b611bdac739d01db0ef7113e790b7b82465fa06062e10ca5f2f664ba7a01bc090630bc76a2c6411b09d39698c969a0e2b";
        String url = HttpStringUtil.Head + HttpStringUtil.PackageControl + HttpStringUtil.ProjectPackage + "?stageId=" + stageid;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 下载文件*
     */
    public void download(String old, String newpathdir, String adress, String end, Handler... uphandler) {
        http.download(old, newpathdir, adress, end, uphandler);
    }

    /**
     * 下载图片*
     */
    public void download(String old, String newpathdir) {
        http.download(old, newpathdir);
    }

    /**
     * 上传项目(验证接口)*
     */
    public void checkStage(Handler handler, int i, String stageId) {
        ///stageControl/checkStage
        String url = HttpStringUtil.Head + HttpStringUtil.stageControl + HttpStringUtil.checkStage + "?stageId=" + stageId;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 上传项目*
     */
    public void upload(Handler handler, int i, File file, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.PackageControl + HttpStringUtil.OfflineUpload;
        RequestParams params = new RequestParams();
        params.addBodyParameter("stage_id", stage_id);
        params.addBodyParameter("file", file);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 上传项目记录及照片
     */
    public void uploadProRecAndPic(Handler handler, int i, File file, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.photoControl + "/offlinePhotoUpload";
        RequestParams params = new RequestParams();
        params.addBodyParameter("stage_id", stage_id);
        params.addBodyParameter("file", file);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * 上传项目记录及照片(验证接口)
     */
    public void checkStageRec(Handler handler, int i, String stageId) {
        String url = HttpStringUtil.Head + HttpStringUtil.stageControl + "/checkStagePh?stageId=" + stageId;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }


    public void getLatLng(Handler handler, int i, String exploration_type, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExplorationControl + HttpStringUtil.ExplorationList_high + "?exploration_type=" + exploration_type + "&stage_id=" + stage_id;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * 检查更新*
     */
    public void getCheckUpdateVersion(Handler handler) {
        String url = HttpStringUtil.Head + HttpStringUtil.systemControl + HttpStringUtil.sysVersion + "?soft_type=" + 11;
        http.Get(HttpStringUtil.getUrl(url), handler, HttpStringUtil.SUCCESSED);
    }

    /**
     * (new)添加项目材料
     */
    public void uploadProjectMateial(Handler handler, RequestParams params) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.AadcodesetVersion;
        http.Post(url, params, handler, HttpStringUtil.SUCCESSED);
    }

    /**
     * (new)修改排序
     */
    public void updateSort(Handler handler, RequestParams params) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.UPDATESORT;
        http.Post(url, params, handler, HttpStringUtil.SUCCESSED);
    }

    /**
     * (new)为项目选择典设
     */
    public void setProjectModel(Handler handler, RequestParams params) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.CopyCodeset;
        http.Post(url, params, handler, HttpStringUtil.SUCCESSED);
    }

    /**
     * (new)重命名项目典设、收藏项目典设、删除项目典设
     *
     * @param type 2重命名、3收藏、4删除
     */
    public void oprtionModel_DS(Handler handler, RequestParams params, int type) {
        String url = "";
        if (type == 2) {
            url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.ModfyCodesetName;
        } else if (type == 3) {
            url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.CollectionCodeSet;
        } else if (type == 4) {
            url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.DelCodeset;
        }
        http.Post(HttpStringUtil.getUrl(url), params, handler, type);
    }

    /**
     * (new)修改项目典设材料*
     */
    public void UpModelMaterial(Handler handler, RequestParams params, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.EditModelMaerial;
        http.Post(HttpStringUtil.getUrl(url), params, handler, caseID);
    }

    /**
     * (new)修改项目典设材料*
     */
    public void UpModelMaterial1(Handler handler, RequestParams params, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/modifymodleMaterial";
        http.Post(HttpStringUtil.getUrl(url), params, handler, caseID);
    }

    /**
     * (new)材料型号查询*
     */
    public void getlikeNameMaterials(Handler handler, int i, String matId, int s, int n, String versoinID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.LikeNameCodeMaterial + "?matId=" + matId + "&versionid=" + versoinID + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * (new)点位材料型号查询*
     */
    public void getlikeNameMaterial(Handler handler, int i, String matId, int s, int n, String versoinID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.LikeNameMaterial + "?matId=" + matId + "&versionid=" + versoinID + "&s=" + s + "&n=" + n;
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * （new）项目典设导入材料*
     */
    public void ImpProMaterial(Handler handler, int i, String id, String codesetid) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.impModelMaerial;
        http.Post(HttpStringUtil.getUrl(url), PostParams.ImpProMaterial(id, codesetid), handler, i);
    }

    /**
     * （new）项目典设添加模块
     */
    public void ImpMaterial2odel(Handler handler, int i, String ids, String codesetid) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/impcodesetModule";
        http.Post(HttpStringUtil.getUrl(url), PostParams.ImpProModelToDS(ids, codesetid), handler, i);
    }


    /**
     * （new）项目模块导入材料*
     */
    public void ImpProModelMaterial(Handler handler, int i, String ids, String codesetid) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/addmodleMaterial";
        RequestParams params = new RequestParams();
        params.addBodyParameter("modle_id", codesetid);
        params.addBodyParameter("material_number", ids);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * (new)删除典设材料*
     */
    public void DelProDetailMaterial(Handler handler, int i, String id) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.DelMaterial;
        http.Post(HttpStringUtil.getUrl(url), PostParams.DelExpMaterial(id), handler, i);
    }

    /**
     * (new)删除模块材料*
     */
    public void DelProModelMaterial(Handler handler, int i, String id) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/delmodleMaterial";
        http.Post(HttpStringUtil.getUrl(url), PostParams.DelExpMaterial(id), handler, i);
    }

    /**
     * (new)+典设材料*
     */
    public void CreateProMoel(Handler handler, RequestParams params, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.AddCodeSet;
        http.Post(HttpStringUtil.getUrl(url), params, handler, caseID);
    }

    /**
     * (new)+速成点设*
     */
    public void CreateProMoel2(Handler handler, RequestParams params, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + HttpStringUtil.addcodesetbyExperence;
        http.Post(HttpStringUtil.getUrl(url), params, handler, caseID);
    }

    /**
     * (new)+项目模块*
     */
    public void CreateProMoel1(Handler handler, RequestParams params, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/aadcodesetVersionAndmodleMaterial";
        http.Post(HttpStringUtil.getUrl(url), params, handler, caseID);
    }

    /**
     * (new)获取项目典设、材料、模块数量
     */
    public void getProCount(Handler handler, String versionid, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.CodesetControl + "/codesetallcount";
        http.Post(HttpStringUtil.getUrl(url), PostParams.GetProItemCount(versionid), handler, caseID);
    }


    /**
     * (new)通过电话号码搜索用户
     */
    public void getProParticipants(Handler handler, String userphone, int caseID) {
        String url = HttpStringUtil.Head + HttpStringUtil.OrgUserControl + "/userByPhoneList?userphone=" + userphone;
        http.Get(HttpStringUtil.getUrl(url), handler, caseID);
    }

    /**
     * (new)获取系统照片类别*
     */
    public void getSysImgTypeList(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.SystemControl + "/sysPhotoType";
        http.Get(HttpStringUtil.getUrl(url), handler, i);
    }

    /**
     * (new)获取获取随手拍项目及其相关数据*
     */
    public void getProRecordList(Handler handler, int caseID, String stageid, String lasttime) {
        String url = HttpStringUtil.Head + HttpStringUtil.photoControl + "/recordAndPhotoList";
        http.Post(HttpStringUtil.getUrl(url), PostParams.getProRec(stageid, lasttime), handler, caseID);
    }

    /**
     * (new)下载问题库及其图例
     */
    public void getAcceptRecord(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProblemControl + "/getProblem";
        http.Post(HttpStringUtil.getUrl(url), PostParams.getProBase(MyApp.userInfo.getOrg_id()), handler, i);
    }

    /**
     * (new)下载项目已存在的问题及其图片
     */
    public void getProjectProblems(Handler handler, int i) {
        String url = HttpStringUtil.Head + HttpStringUtil.ProblemControl + "/getproblemExist";
        http.Post(HttpStringUtil.getUrl(url), PostParams.getProItem(MyApp.currProject.getStage_id()), handler, i);
    }

    /**
     * 上传项目验收记录及照片
     */
    public void uploadProYHAndPic(Handler handler, int i, File file, String stage_id) {
        String url = HttpStringUtil.Head + HttpStringUtil.photoControl + "/offlineProblemUpload";
        RequestParams params = new RequestParams();
        params.addBodyParameter("stage_id", stage_id);
        params.addBodyParameter("file", file);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

    /**
     * (new)上传离线点位数据(材料、模块、典设)*
     */
    public void upPointOfflineData(Handler handler, int i, String date) {
        String url = HttpStringUtil.Head + HttpStringUtil.ExpCodesetControl + "/saveOLineCodeset";
        RequestParams params = new RequestParams();
        params.addBodyParameter("editJson", date);
        http.Post(HttpStringUtil.getUrl(url), params, handler, i);
    }

}
